Imports System.Collections.Generic
Imports BruTile
Imports BruTile.Web

Public Class WmsTileSource
    Implements ITileSource
    Private _provider As ITileProvider
    Private _schema As ITileSchema

    Public Sub New(provider As ITileProvider, schema As ITileSchema)
        _provider = provider
        _schema = schema
    End Sub

    Public ReadOnly Property Provider() As ITileProvider Implements ITileSource.Provider
        Get
            Return _provider
        End Get
    End Property

    Public ReadOnly Property Schema() As ITileSchema Implements ITileSource.Schema
        Get
            Return _schema
        End Get
    End Property

    Public Shared Function Create(serverInfo As WmsServerInfo) As WmsTileSource
        Dim href = serverInfo.OnlineResource
        Dim layers = New List(Of String)() From { _
            serverInfo.Layer _
        }

        'new GlobalMercator("image/png");
        Dim schema = New UnProjected()
        ' styles
        ' custom parameters
        Dim request = New WmscRequest(New Uri(href), schema, layers, New List(Of String)(), New Dictionary(Of String, String)(), serverInfo.Version)
        Dim provider = New WebTileProvider(request)
        Return New WmsTileSource(provider, schema)
    End Function
End Class
